import { Message, Converse, MessageType, WsMessage } from "../model/im";

/**
 * [Service] 转发消息到客户端
 */
export interface ServiceImSendMessageToWsClientParams {
  user_id?: number;
  member_uid?: number;
  client?: string[];
  message: WsMessage;
}

export interface ServiceImHandleSendMessageParamsMessage extends Message {
  ic_id: number;
  msg_type: MessageType;
  from_uid: number;
  to_uid: number;
  msg_content: string;
  sent_time: number;
}

/**
 * [Service] 发送消息
 */
export interface ServiceImHandleSendMessageParams {
  message: ServiceImHandleSendMessageParamsMessage;
}

/**
 * [Service] 进入会话后回调 清空未读消息数
 */
export interface ServiceImToggleConverse {
  ic_id: number;
}

/**
 * [Service] 拉取会话聊天记录
 */
export interface ServiceImFetchMessageParams {
  /** 会话ID */
  ic_id: number;
  /** 消息的发送时间 如果传递则获取这个时间戳以前的数据 */
  sent_time: number;
  pageSize: number;
}

/**
 * [Service] 文字转语音
 */
export interface ServiceImGetTtsMp3UrlParams {
  text: string;
}

export interface WechatMessage {
  /** 消息来自的公众号id */
  ToUserName: string;
  /** 会员openid */
  FromUserName: string;
  CreateTime: number;
  MsgType: string;
  Content: string;
  MsgId?: string;
}